package com.base.common.persistent.dao;

import java.util.List;
import java.util.Map;

import com.base.common.persistent.model.PointHour;
import org.apache.ibatis.annotations.Param;

import com.base.common.persistent.model.InspectionTicket;

/**
 * 巡查工单dao
 * 
 * @author Kevin Colin
 * @datetime 2015年9月6日上午11:36:17
 * 
 */
public interface InspectionTicketMapper {

	/**
	 * 添加巡查工单
	 * 
	 * @param {@link
	 * 			InspectionTicket inspectionTicket}
	 * @return
	 */
	public int addInspectionTicket(InspectionTicket inspectionTicket);

	/**
	 * 根据工单code查询工单
	 * 
	 * @param code
	 * @return
	 */
	public InspectionTicket queryInspectionTicketByCode(@Param(value = "code") String code);

	/**
	 * 查询最新巡查工单号
	 * 
	 * @return
	 */
	public String queryLastCode();



    /**
	 * 获取巡查工单数量根据巡查点分组并根据日期查询
	 *
     * @param compoundsId
	 * @param startTime
	 * @param endTime
	 * @return
	 */

	public List<Map> getInspectionTicketCountsGroupByPointByDate(
			@Param(value = "compoundsId") int compoundsId,
			@Param(value = "startTime") String startTime, @Param(value = "endTime") String endTime);

	/**
	 * @param compoundsId
	 * @param startTime
	 * @param endTime
	 * @param hour
	 * @return
	 */
	public List<InspectionTicket> getInspectionTicketListGroupByPointByDateTime(@Param(value = "compoundsId") int compoundsId,
			@Param(value = "startTime") String startTime, @Param(value = "endTime") String endTime,
			@Param(value = "hour") int hour, @Param(value = "inspectionPointID") int inspectionPointID);

	public List<PointHour> selectPointIdHour(@Param(value = "compoundsId") int compoundsId,
											 @Param(value = "startTime") String startTime, @Param(value = "endTime") String endTime);

	List<InspectionTicket> selectByPointIdsAndDateTime(@Param(value = "inspectionPoints") List<Integer> inspectionPoints,
													   @Param(value = "startTime") String startTime, @Param(value = "endTime") String endTime);

    public int getIsExistInspectionByCondition( @Param(value = "startTime") String s,  @Param(value = "endTime") String s1,  @Param(value = "pointId") int pointId,  @Param(value = "hour") int hour);
}
